package com.mazaiting.gateway.router;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.RequestPredicates;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;

/**
 * 网关路由
 */
@Configuration
public class TestRouter {

    @Bean
    public RouterFunction<ServerResponse> captchaRouterFunction(TestHandler testHandler) {
        return RouterFunctions
                .route(RequestPredicates.GET("/test")
                        .and(RequestPredicates.accept(MediaType.APPLICATION_JSON)), testHandler);
    }

}